package cn.gson.springboot.model.pojos;

import org.aspectj.apache.bcel.classfile.Module;

import javax.persistence.*;
import java.sql.Date;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "qa_", schema = "crm")
public class Qa {
    private int qaId;
    private String qaQuestion;
    private String qaAnswer;
    private Date qaCreateDate;
    private Integer qaType;
    private Employee employeeByEmpId;

    @Id
    @Column(name = "qa_id", nullable = false)
    public int getQaId() {
        return qaId;
    }

    public void setQaId(int qaId) {
        this.qaId = qaId;
    }

    @Basic
    @Column(name = "qa_question", nullable = true, length = 255)
    public String getQaQuestion() {
        return qaQuestion;
    }

    public void setQaQuestion(String qaQuestion) {
        this.qaQuestion = qaQuestion;
    }

    @Basic
    @Column(name = "qa_answer", nullable = true, length = 255)
    public String getQaAnswer() {
        return qaAnswer;
    }

    public void setQaAnswer(String qaAnswer) {
        this.qaAnswer = qaAnswer;
    }

    @Basic
    @Column(name = "qa_create_date", nullable = true)
    public Date getQaCreateDate() {
        return qaCreateDate;
    }

    public void setQaCreateDate(Date qaCreateDate) {
        this.qaCreateDate = qaCreateDate;
    }

    @Basic
    @Column(name = "qa_type", nullable = true)
    public Integer getQaType() {
        return qaType;
    }

    public void setQaType(Integer qaType) {
        this.qaType = qaType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Qa qa = (Qa) o;
        return qaId == qa.qaId &&
                Objects.equals(qaQuestion, qa.qaQuestion) &&
                Objects.equals(qaAnswer, qa.qaAnswer) &&
                Objects.equals(qaCreateDate, qa.qaCreateDate) &&
                Objects.equals(qaType, qa.qaType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(qaId, qaQuestion, qaAnswer, qaCreateDate, qaType);
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @Override
    public String toString() {
        return "Qa{" +
                "qaId=" + qaId +
                ", qaQuestion='" + qaQuestion + '\'' +
                ", qaAnswer='" + qaAnswer + '\'' +
                ", qaCreateDate=" + qaCreateDate +
                ", qaType=" + qaType +
                '}';
    }
}
